package com.supemarket.dao.impl;

import com.supemarket.dao.BaseDao;
import com.supemarket.dao.UpdateSupemarket;
import com.supemarket.entity.Member;
import com.supemarket.entity.admin;
import com.supemarket.entity.commodity;
import com.supemarket.entity.purchase;
import com.supemarket.entity.sale;
import com.supemarket.entity.staff;
import com.supemarket.entity.supplier;

public class UpdateSupemarketimpl  extends BaseDao implements UpdateSupemarket{

	String sql ="";
	@Override
	public int adminup(admin admin) {
		
		return 0;
	}

	@Override
	public int commoditieup(commodity commodity) {
		String sql ="UPDATE commodity SET cname=?,cprice=?,cbarcode=?,sid=?,cstock=?,"
				+ "ccreationtime=?,modificationtime=?,MODIFIER=? WHERE cid=?";
		return this.executeUpdate(sql, commodity.getCname(),commodity.getCprice(),commodity.getCbarcode(),commodity.getSid(),commodity.getCstock()
				,commodity.getCcreationtime(),commodity.getModificationtime(),commodity.getModifier(),commodity.getCid());
	}

	@Override
	public int memberup(Member menber) {
		String sql = "update member set mnumber=?,mname=?,mpassword=?,mphone=?,mintegral=?,"
				+ "mbalance=?,mregistration=?,creationtime=?,modificationtime=?,modifier=? where mid=?";
		return this.executeUpdate(sql, menber.getMnumber(),menber.getMname(),menber.getMpassword(),menber.getMphone(),
				menber.getMintegral(),menber.getMbalance(),menber.getMregistration(),menber.getCreationtime(),menber.getModificationtime(),menber.getModifier(),menber.getMid());
	}

	@Override
	public int purchaseup(purchase purchase) {
		String sql ="update purchase set pprice=?,pnumber=?,pmoney=?,pdate=?,psupplier=?,creationtime=?,modificationtime=?,modifier=? where pid=?";
		return this.executeUpdate(sql, purchase.getPprice(),purchase.getPnumber(),purchase.getPmoney(),purchase.getPdate(),purchase.getPsupplier(),purchase.getCreationtime(),purchase.getModificationtime(),purchase.getModifier(),purchase.getPid());
	}

	@Override
	public int saleup(sale sale) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int staffup(staff staff) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int supplierup(supplier supplier) {
		// TODO Auto-generated method stub
		return 0;
	}

}
